package com.coke.im.client.stream;

import java.nio.charset.Charset;

import com.coke.im.client.type.MessageHeadConstant;
import com.coke.im.client.util.StringUtils;

public class MessageTemp {

    public static Message loginMessage(String userId,String password,int liveTime){
        Message msg = new Message();
        msg.setHead(MessageHeadConstant.TYPE,MessageHeadConstant.LOGIN);
        msg.setHead(MessageHeadConstant.USERNAME,userId);
        msg.setHead(MessageHeadConstant.PASSWORD,password);
        msg.setHead(MessageHeadConstant.TIME,String.valueOf(liveTime));
        return msg;
    }
    
    public static Message sendMessage(String userId,String msgs){
        Message msg = new Message();
        msg.setHead(MessageHeadConstant.TYPE,MessageHeadConstant.MESSAGE);
        msg.setHead(MessageHeadConstant.TO,userId);
        msg.setHead(MessageHeadConstant.MESSAGE_ID, StringUtils.UUID(6));
        msg.setBody(msgs.getBytes(Charset.forName("UTF-8")));
        return msg;
    }
    
    
    public static Message liveMessage(){
        Message msg = new Message();
        msg.setHead(MessageHeadConstant.TYPE,MessageHeadConstant.LIVE);
        return msg;
    }

}
